<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
			
			// #ifdef MP
			uni.login({
				success: res => {
					// 发送 res.code 到后台换取 openId, sessionKey, unionId
					let {
						code
					} = res;
					uni.request({
						url: 'http://127.0.0.1:5000/api/getopenid',
						method: "POST",
						data: {
							code
						},
						success(res) {
							let {
								openid
							} = res.data;
							uni.setStorageSync('openid', openid)
						}
					})
				}
			})
			// #endif
			

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	/* @import "../../common/uni.css"; */

	page {
		/* background-color: red; */
	}
</style>